<?php
class Admin_Model_Login extends Zend_Db_Table{
	
	protected $_name = 'user';
	protected $_primary = 'userid';
	
	public function listUser($arrParam = null, $option = null){
		$db = Zend_Registry::get('connectDb');
		//$db = Zend_Db::factory($adapter, $config);
		
		if(!isset($arrParam['username']) && !isset($arrParam['password'])){
			$userName = null;
			$passWord = null;
		}else{
			$userName = $arrParam['username'];
			$passWord = $arrParam['password'];
		}
		
		$where = 'username = \'' . $userName  . '\' AND password = \'' . $passWord . '\'';
		$select = $db->select()
					 ->from('user AS u', array('username', 'password'))
					 ->where($where); 
		
// 		echo '<pre>';
// 		print_r($select);
// 		echo '</pre>';
		
		return $select;
	}
}